bpf/verifier: fix bounds calculation on BPF_RSH
authorEdward Cree <ecree@solarflare.com>
Tue, 19 Dec 2017 04:11:53 +0000 (20:11 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 Dec 2017 14:12:23 +0000 (14:12 +0000)
commitaada7b948ad1f8233216f664d147686cc4e4a289
tree2c808df8b672b8c27855c782f34fb761b9c7cf79
parent364a33f23c2e65ce6a81c01b6c6df63684b730e1
bpf/verifier: fix bounds calculation on BPF_RSH

Incorrect signed bounds were being computed.
If the old upper signed bound was positive and the old lower signed bound was
negative, this could cause the new upper signed bound to be too low,
leading to security issues.

Fixes: b03c9f9fdc37 ("bpf/verifier: track signed and unsigned min/max values")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Edward Cree <ecree@solarflare.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
[jannh@google.com: changed description to reflect bug impact]
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name bpf-verifier-fix-bounds-calculation-on-bpf_rsh.patch
kernel/bpf/verifier.c